package net.zhuike.novel.app.service;

import android.content.Context;

import net.zhuike.novel.app.bean.BookMixAToc;
import net.zhuike.novel.app.bean.BookSit;
import net.zhuike.novel.app.bean.ChapterRead;
import net.zhuike.novel.app.bean.RankingList;
import net.zhuike.novel.app.bean.Rankings;

import java.util.Map;

import framework.common.zanetwork.UeHttpUrl;
import framework.common.zanetwork.core.HttpCallback;
import framework.common.zanetwork.core.ResponseCallback;
import okhttp3.Response;

/**
 * Created by qi.wang on 2017/6/12.
 * 阅读service
 */

public class BookReadService extends BaseService{
    public static  void getBookMixAToc(final Context context,String id,final ResponseCallback<BookSit> callback){
        httpHelper.get(UeHttpUrl.getBookMixAToc(id), null, new HttpCallback<BookSit>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, BookSit o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void getChapterContent(final Context context,String url,String []header, final ResponseCallback<String> callback){
        httpHelper.getRead(url, header, new HttpCallback<String>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, String o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void getChapterRead(final Context context,String url, final ResponseCallback<String> callback){
        readHelper.get(url, null, new HttpCallback<String>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, String o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static  void requestInput(final Context context,String url, final ResponseCallback<String> callback){
        readHelper.get(url, null, new HttpCallback<String>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, String o) {
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {
                callback.onError(response, code, failureMsg, null);
            }
        });
    }
}
